home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / dev / lang / sbp3_1e.lzh / CICHLID.PL < prev    next >
Text File  |  1991-10-31  |  6KB  |  207 lines

  1. /* From the book PROLOG PROGRAMMING IN DEPTH
  2.    by Michael A. Covington, Donald Nute, and Andre Vellino.
  3.    Copyright 1988 Scott, Foresman & Co.
  4.    Non-commercial distribution of this file is permitted. */
  5. /* Modified for Quintus Prolog by Andreas Siebert */
  6.  
  7. /* CICHLID.PL */
  8.  
  9. /*
  10.  * Contains an XSHELL knowledge base.
  11.  * Requires all procedures in XSHELL.PL.
  12.  */
  13.  
  14. :- ( clause(xshell,_) ; consult('xshell.pl') ).
  15.  
  16. /* Any clauses for the predicates XKB_INTRO,
  17.    xkb_report, XKB_UNIQUE, XKB_EXPLAIN, XKB_IDENTIFY, and
  18.    XKB_QUESTION should be removed from the knowledge base. */
  19.  
  20. :- abolish(xkb_intro,1).
  21. :- abolish(xkb_report,1).   
  22. :- abolish(xkb_unique,1). 
  23. :- abolish(xkb_explain,1). 
  24. :- abolish(xkb_identify,1).
  25. :- abolish(xkb_question,2).
  26.  
  27. xkb_intro(
  28.  ['',
  29.   'CICHLID: An Expert System for Identifying Dwarf Cichlids',
  30.   '',
  31.   'The cichlids are a family of tropical fish.  Many of',
  32.   'these fish are large and can only be kept in large',
  33.   'aquariums. Others, called ''dwarf cichlids'', rarely',
  34.   'exceed 3 inches and can be kept in smaller aquariums.',
  35.   '',
  36.   'This program will help you identify many of the more',
  37.   'familiar species of dwarf cichlid.  Identification of',
  38.   'these fish is not always easy, and the program may offer',
  39.   'more than one possible identification.  Even then, you',
  40.   'should consult photographs in an authoritative source',
  41.   'such as Staek, AMERIKANISCHE CICHLIDEN I: KLEINE',
  42.   'BUNTBARSCHE (Melle: Tetra Verlag, 1984), or Goldstein,',
  43.   'CICHLIDS OF THE WORLD (Neptune City, New Jersey:',
  44.   't.f.h. Publications, 1973) for positive identification.',
  45.   '',
  46.   'To use the program, simply describe the fish by',
  47.   'answering the following questions.']).
  48.  
  49. xkb_report('Possible identification: ').
  50. xkb_unique(no).
  51. xkb_explain(no).
  52.  
  53. /*
  54.  * xkb_identify(Species)
  55.  *   Each clause for this predicate provides a rule to be
  56.  *   used with the utility predicates in the XSHELL.PRO file
  57.  *   to determine whether the fish to be identified is likely
  58.  *   to belong to the Species.
  59.  */
  60.  
  61. xkb_identify('Apistogramma agassizii'):-
  62.      parm(caudal,c,s),
  63.      parm(body_shape,c,l),
  64.      parm(lateral_stripe,c,d),
  65.      prop(dorsal_streamer),
  66.      prop(lateral_stripe_extends_into_tail).
  67.  
  68. xkb_identify('Apistogramma borelli'):-
  69.      parm(caudal,c,n),
  70.      parm(body_shape,c,d),
  71.      parm(lateral_stripe,c,i),
  72.      prop(dorsal_streamer),
  73.      prop(ventral_streamer),
  74.      prop(lateral_stripe_extends_into_tail),
  75.      parm(color,c,y).
  76.  
  77. xkb_identify('Apistogramma cacatuoides'):-
  78.      parm(caudal,c,l),
  79.      parm(body_shape,c,d),
  80.      parm(lateral_stripe,c,d),
  81.      prop(dorsal_crest),
  82.      prop(dorsal_streamer),
  83.      prop(anal_streamer),
  84.      prop(stripes_in_lower_body),
  85.      prop(lateral_stripe_extends_into_tail).
  86.  
  87. xkb_identify('Apistogramma trifasciata'):-
  88.      parm(caudal,c,n),
  89.      parm(body_shape,c,n),
  90.      parm(lateral_stripe,c,d),
  91.      prop(dorsal_crest),
  92.      prop(dorsal_streamer),
  93.      prop(anal_streamer),
  94.      prop(ventral_streamer),
  95.      prop(lateral_stripe_extends_into_tail),
  96.      prop(angular_line_above_ventral).
  97.  
  98. xkb_identify('Lamprologus brichardi'):-
  99.      parm(caudal,c,l),
  100.      parm(body_shape,c,n),
  101.      parm(lateral_stripe,c,n),
  102.      parm(color,c,g),
  103.      prop(gill_spot),
  104.      prop(fins_trimmed_white).
  105.  
  106. xkb_identify('Pelvicachromis pulcher'):-
  107.      parm(caudal,c,s),
  108.      parm(body_shape,c,l),
  109.      prop(dorsal_streamer),
  110.      prop(anal_streamer),
  111.      prop(orange_spots_in_tail).
  112.  
  113. xkb_identify('Microgeophagus ramirezi'):-
  114.      parm(caudal,c,n),
  115.      parm(body_shape,c,d),
  116.      parm(lateral_stripe,c,n),
  117.      prop(dorsal_crest),
  118.      parm(color,c,v).
  119.  
  120. xkb_identify('Nannacara anomala'):-
  121.      parm(caudal,c,n),
  122.      parm(body_shape,c,d),
  123.      parm(lateral_stripe,c,n),
  124.      parm(color,c,m).
  125.  
  126. xkb_identify('Nanochromis nudiceps'):-
  127.      parm(caudal,c,n),
  128.      parm(body_shape,c,l),
  129.      parm(lateral_stripe,c,n),
  130.      parm(color,c,b).
  131.  
  132. /*
  133.  * xkb_question(Property_or_Parameter,Question)
  134.  *   Each of these clauses provides a question or a simple
  135.  *   menu to be used by the utility predicates in the
  136.  *   XSHELL.PRO file to ask the user whether the fish to be
  137.  *   identified has the property or what value the parameter
  138.  *   takes for the fish.
  139. */
  140.  
  141. xkb_question(caudal,
  142.      ['What is the shape of the tail-fin?',
  143.       '  (l)  Lyre-shaped',
  144.       '  (s)  Spear-shaped',
  145.       '  (n)  Normal, i.e, round or fan-shaped.']).
  146.  
  147. xkb_question(body_shape,
  148.      ['What is the shape of the body?',
  149.       '  (l)  Long and narrow.',
  150.       '  (d)  Deep, heavy and short.',
  151.       '  (n)  Normal fish shape.']).
  152.  
  153. xkb_question(dorsal_crest,
  154.      ['Are any fin rays at the front of the dorsal fin',
  155.       'clearly extended above the rest of the fin?']).
  156.  
  157. xkb_question(dorsal_streamer,
  158.      ['Are any fin rays at the back of the dorsal fin',
  159.       'clearly extended into a long streamer?']).
  160.  
  161. xkb_question(anal_streamer,
  162.      ['Are any fin rays at the back of the anal fin',
  163.       'clearly extended into a long streamer?']).
  164.  
  165. xkb_question(ventral_streamer,
  166.      ['Are any fin rays at the bottom of the ventral',
  167.       'fins clearly extended into streamers?']).
  168.  
  169. xkb_question(lateral_stripe,
  170.      ['Describe the line running the length of the body.',
  171.       '  (d)  Sharp and distinct from eye to base of tail.',
  172.       '  (i)  Irregular, indistinct or incomplete.',
  173.       '  (n)  None visible or barely visible.']).
  174.  
  175. xkb_question(color,
  176.      ['What is the basic color of the body?',
  177.       '  (b)  pale blue,',
  178.       '  (g)  pale gray,',
  179.       '  (m)  metallic bronze or green,',
  180.       '  (v)  violet, yellow and claret highlights,',
  181.       '  (y)  yellow,',
  182.       '  (n)  none of the above.']).
  183.  
  184. xkb_question(lateral_stripe_extends_into_tail,
  185.      ['Does the stripe down the side extend into the base',
  186.       'of the tail?']).
  187.  
  188. xkb_question(stripes_in_lower_body,
  189.       ['Are there horizontal stripes in the lower part',
  190.        'of the body?']).
  191.  
  192. xkb_question(angular_line_above_ventral,
  193.      ['Is there an angular line above the ventral fin',
  194.       'slanting from the pectoral downward toward the',
  195.       'stomach region?']).
  196.  
  197. xkb_question(orange_spots_in_tail,
  198.       ['Are there black spots trimmed in orange in',
  199.        'the tail fin?']).
  200.  
  201. xkb_question(gill_spot,'Is there a dark spot on the gill?').
  202.  
  203. xkb_question(fins_trimmed_white,
  204.       'Are the unpaired fins trimmed with a white edge?').
  205.  
  206. :- xshell.
  207.